package me.zhengjie.gas.repositories;

import me.zhengjie.gas.dto.DeptSettingsDto;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

public interface DeptSettingsRepository extends JpaRepository<DeptSettingsDto, Integer>  {

	@Query(value = "select * from {h-schema}dept_settings where dept_id=:deptId", nativeQuery = true)
	DeptSettingsDto findByDeptId(@Param("deptId") Long deptId);

	@Modifying
	@Transactional
	@Query(value = "delete from {h-schema}dept_settings where dept_id=:deptId", nativeQuery = true)
	int deleteByDeptId(@Param("deptId") Long deptId);
}
